<!-- 调拨单记录 -->
<template>
    <div id="change">
        <div class="change-top">
        </div>
        <div class=" change-content">
            <el-table :row-style="{ height: '55px' }" height="450px" border :data="taskList"
                style="width: calc(100% - 30px);font-size: 13px;">
                <el-table-column align="center" prop="taskId" label="任务id" width="200">
                </el-table-column>
                <el-table-column align="center" prop="billCode" label="单据号" width="300">
                </el-table-column>
                <el-table-column align="center" prop="createDate" label="开始时间" width="300">
                </el-table-column>
                <el-table-column align="center" prop="name" label="任务名称" width="200">
                </el-table-column>
                <el-table-column align="center" prop="kindCode" label="单据类型编号" width="150">
                </el-table-column>
                <el-table-column align="center" prop="kindName" label="单据类型" width="150">
                </el-table-column>
                <el-table-column align="center" fixed="right" label="操作" width="200">
                    <template slot-scope="scope">
                        <el-button type="warning" size="small"
                            @click="dealTask(scope.row.taskId, scope.row.billCode, scope.row.kindCode)">处理</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
import axios from 'axios';

export default {
    name: 'TaskList',
    data() {
        return {
            taskList: [],
            userCode: '小a'
        }
    },
    methods: {
        getTaskList() {
            this.axios.get('/myProcess/getTaskList',
                {
                    params: {
                        userCode: this.userCode
                    }
                }
            ).then(rs => {
                this.taskList = rs.data.taskList
            })
        },
        dealTask(taskId, billCode, kindCode) {
            if (kindCode == "CBTZ") {
                //跳转成本调整
                this.goto(taskId, 'adjustChangeDetails', billCode)
            }
            if (kindCode == "FKD") {
                this.goto(taskId, 'paymentDetail', billCode)
            }
            if (kindCode == "SKD") {
                this.goto(taskId, 'rceiptDetail', billCode)
            }
            if (kindCode == "HXD") {
                this.axios({
                    url: "/cash/writeOff/selectByCode",
                    params: {
                        billCode: billCode
                    }
                }).then(rs => {
                    if (rs.data.receipt.serviceType === "应收转应收") {
                        this.goto(taskId, 'writeOff4Detail', billCode)
                    } else {
                        this.goto(taskId, 'writeOff5Detail', billCode)
                    }
                })
            }
            if(kindCode=="GHDD"){
                this.goto(taskId, 'Order', billCode)
            }
            if(kindCode=="GHD"){
                this.goto(taskId, 'PurchaseOrder', billCode)
            }
            if(kindCode=="GHTH"){
                this.goto(taskId, 'PurReturnOrder', billCode)
            }
        },
        goto(taskId, to, billCode) {
            this.$router.push(
                {
                    path: to,
                    query: {
                        taskId,
                        billCode
                    }
                }
            )
        }
    },
    created() {
        this.getTaskList()
    }

}
</script>

<style scoped>
#change {
    width: 100%;
    height: 100%;
}

.change-top {
    width: calc(100% -20px);
    height: 60px;
    /* background-color: pink; */
    line-height: 60px;
    padding-left: 20px;
    font-size: 13px;
}

.change-content {
    width: 100%;
    height: calc(100% - 60px);
    margin-top: 40px;
    /* background-color: skyblue; */
}

.el-input,
.el-button {
    font-size: 13px;
}

/* 合计行整体样式修改开始 */
.el-table /deep/ .el-table__footer-wrapper tbody td {
    background-color: #fff1d4;
}

.el-table /deep/ .el-table__body tr:hover>td {
    background-color: #fff1d4;
}
</style>